home *** CD-ROM | disk | FTP | other *** search
/ Halting the Hacker - A P…uide to Computer Security / Halting the Hacker - A Practical Guide to Computer Security.iso / rfc / rfc1072.txt < prev    next >
Text File  |  1997-04-01  |  35KB  |  894 lines

  1. Network Working Group                                        V. Jacobson
  2. Request for Comments: 1072                                           LBL
  3.                                                                R. Braden
  4.                                                                      ISI
  5.                                                             October 1988
  6.  
  7.  
  8.                   TCP Extensions for Long-Delay Paths
  9.  
  10.  
  11. Status of This Memo
  12.  
  13.    This memo proposes a set of extensions to the TCP protocol to provide
  14.    efficient operation over a path with a high bandwidth*delay product.
  15.    These extensions are not proposed as an Internet standard at this
  16.    time.  Instead, they are intended as a basis for further
  17.    experimentation and research on transport protocol performance.
  18.    Distribution of this memo is unlimited.
  19.  
  20. 1. INTRODUCTION
  21.  
  22.    Recent work on TCP performance has shown that TCP can work well over
  23.    a variety of Internet paths, ranging from 800 Mbit/sec I/O channels
  24.    to 300 bit/sec dial-up modems [Jacobson88].  However, there is still
  25.    a fundamental TCP performance bottleneck for one transmission regime:
  26.    paths with high bandwidth and long round-trip delays.  The
  27.    significant parameter is the product of bandwidth (bits per second)
  28.    and round-trip delay (RTT in seconds); this product is the number of
  29.    bits it takes to "fill the pipe", i.e., the amount of unacknowledged
  30.    data that TCP must handle in order to keep the pipeline full.  TCP
  31.    performance problems arise when this product is large, e.g.,
  32.    significantly exceeds 10**5 bits.  We will refer to an Internet path
  33.    operating in this region as a "long, fat pipe", and a network
  34.    containing this path as an "LFN" (pronounced "elephan(t)").
  35.  
  36.    High-capacity packet satellite channels (e.g., DARPA's Wideband Net)
  37.    are LFN's.  For example, a T1-speed satellite channel has a
  38.    bandwidth*delay product of 10**6 bits or more; this corresponds to
  39.    100 outstanding TCP segments of 1200 bytes each!  Proposed future
  40.    terrestrial fiber-optical paths will also fall into the LFN class;
  41.    for example, a cross-country delay of 30 ms at a DS3 bandwidth
  42.    (45Mbps) also exceeds 10**6 bits.
  43.  
  44.    Clever algorithms alone will not give us good TCP performance over
  45.    LFN's; it will be necessary to actually extend the protocol.  This
  46.    RFC proposes a set of TCP extensions for this purpose.
  47.  
  48.    There are three fundamental problems with the current TCP over LFN
  49.  
  50.  
  51.  
  52. Jacobson & Braden                                               [Page 1]
  53.  
  54. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  55.  
  56.  
  57.    paths:
  58.  
  59.  
  60.    (1)  Window Size Limitation
  61.  
  62.         The TCP header uses a 16 bit field to report the receive window
  63.         size to the sender.  Therefore, the largest window that can be
  64.         used is 2**16 = 65K bytes.  (In practice, some TCP
  65.         implementations will "break" for windows exceeding 2**15,
  66.         because of their failure to do unsigned arithmetic).
  67.  
  68.         To circumvent this problem, we propose a new TCP option to allow
  69.         windows larger than 2**16. This option will define an implicit
  70.         scale factor, to be used to multiply the window size value found
  71.         in a TCP header to obtain the true window size.
  72.  
  73.  
  74.    (2)  Cumulative Acknowledgments
  75.  
  76.         Any packet losses in an LFN can have a catastrophic effect on
  77.         throughput.  This effect is exaggerated by the simple cumulative
  78.         acknowledgment of TCP.  Whenever a segment is lost, the
  79.         transmitting TCP will (eventually) time out and retransmit the
  80.         missing segment. However, the sending TCP has no information
  81.         about segments that may have reached the receiver and been
  82.         queued because they were not at the left window edge, so it may
  83.         be forced to retransmit these segments unnecessarily.
  84.  
  85.         We propose a TCP extension to implement selective
  86.         acknowledgements.  By sending selective acknowledgments, the
  87.         receiver of data can inform the sender about all segments that
  88.         have arrived successfully, so the sender need retransmit only
  89.         the segments that have actually been lost.
  90.  
  91.         Selective acknowledgments have been included in a number of
  92.         experimental Internet protocols -- VMTP [Cheriton88], NETBLT
  93.         [Clark87], and RDP [Velten84].  There is some empirical evidence
  94.         in favor of selective acknowledgments -- simple experiments with
  95.         RDP have shown that disabling the selective acknowlegment
  96.         facility greatly increases the number of retransmitted segments
  97.         over a lossy, high-delay Internet path [Partridge87].  A
  98.         simulation study of a simple form of selective acknowledgments
  99.         added to the ISO transport protocol TP4 also showed promise of
  100.         performance improvement [NBS85].
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108. Jacobson & Braden                                               [Page 2]
  109.  
  110. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  111.  
  112.  
  113.    (3)  Round Trip Timing
  114.  
  115.         TCP implements reliable data delivery by measuring the RTT,
  116.         i.e., the time interval between sending a segment and receiving
  117.         an acknowledgment for it, and retransmitting any segments that
  118.         are not acknowledged within some small multiple of the average
  119.         RTT.  Experience has shown that accurate, current RTT estimates
  120.         are necessary to adapt to changing traffic conditions and,
  121.         without them, a busy network is subject to an instability known
  122.         as "congestion collapse" [Nagle84].
  123.  
  124.         In part because TCP segments may be repacketized upon
  125.         retransmission, and in part because of complications due to the
  126.         cumulative TCP acknowledgement, measuring a segments's RTT may
  127.         involve a non-trivial amount of computation in some
  128.         implementations.  To minimize this computation, some
  129.         implementations time only one segment per window.  While this
  130.         yields an adequate approximation to the RTT for small windows
  131.         (e.g., a 4 to 8 segment Arpanet window), for an LFN (e.g., 100
  132.         segment Wideband  Network windows) it results in an unacceptably
  133.         poor RTT estimate.
  134.  
  135.         In the presence of errors, the problem becomes worse.  Zhang
  136.         [Zhang86], Jain [Jain86] and Karn [Karn87] have shown that it is
  137.         not possible to accumulate reliable RTT estimates if
  138.         retransmitted segments are included in the estimate.  Since a
  139.         full window of data will have been transmitted prior to a
  140.         retransmission, all of the segments in that window will have to
  141.         be ACKed before the next RTT sample can be taken.  This means at
  142.         least an additional window's worth of time between RTT
  143.         measurements and, as the error rate approaches one per window of
  144.         data (e.g., 10**-6 errors per bit for the Wideband Net), it
  145.         becomes effectively impossible to obtain an RTT measurement.
  146.  
  147.         We propose a TCP "echo" option that allows each segment to carry
  148.         its own timestamp.  This will allow every segment, including
  149.         retransmissions, to be timed at negligible computational cost.
  150.  
  151.  
  152.    In designing new TCP options, we must pay careful attention to
  153.    interoperability with existing implementations.  The only TCP option
  154.    defined to date is an "initial option", i.e., it may appear only on a
  155.    SYN segment.  It is likely that most implementations will properly
  156.    ignore any options in the SYN segment that they do not understand, so
  157.    new initial options should not cause a problem.  On the other hand,
  158.    we fear that receiving unexpected non-initial options may cause some
  159.    TCP's to crash.
  160.  
  161.  
  162.  
  163.  
  164. Jacobson & Braden                                               [Page 3]
  165.  
  166. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  167.  
  168.  
  169.    Therefore, in each of the extensions we propose, non-initial options
  170.    may be sent only if an exchange of initial options has indicated that
  171.    both sides understand the extension.  This approach will also allow a
  172.    TCP to determine when the connection opens how big a TCP header it
  173.    will be sending.
  174.  
  175. 2. TCP WINDOW SCALE OPTION
  176.  
  177.    The obvious way to implement a window scale factor would be to define
  178.    a new TCP option that could be included in any segment specifying a
  179.    window.  The receiver would include it in every acknowledgment
  180.    segment, and the sender would interpret it.  Unfortunately, this
  181.    simple approach would not work.  The sender must reliably know the
  182.    receiver's current scale factor, but a TCP option in an
  183.    acknowledgement segment will not be delivered reliably (unless the
  184.    ACK happens to be piggy-backed on data).
  185.  
  186.    However, SYN segments are always sent reliably, suggesting that each
  187.    side may communicate its window scale factor in an initial TCP
  188.    option.  This approach has a disadvantage: the scale must be
  189.    established when the connection is opened, and cannot be changed
  190.    thereafter.  However, other alternatives would be much more
  191.    complicated, and we therefore propose a new initial option called
  192.    Window Scale.
  193.  
  194. 2.1  Window Scale Option
  195.  
  196.       This three-byte option may be sent in a SYN segment by a TCP (1)
  197.       to indicate that it is prepared to do both send and receive window
  198.       scaling, and (2) to communicate a scale factor to be applied to
  199.       its receive window.  The scale factor is encoded logarithmically,
  200.       as a power of 2 (presumably to be implemented by binary shifts).
  201.  
  202.       Note: the window in the SYN segment itself is never scaled.
  203.  
  204.       TCP Window Scale Option:
  205.  
  206.       Kind: 3
  207.  
  208.              +---------+---------+---------+
  209.              | Kind=3  |Length=3 |shift.cnt|
  210.              +---------+---------+---------+
  211.  
  212.       Here shift.cnt is the number of bits by which the receiver right-
  213.       shifts the true receive-window value, to scale it into a 16-bit
  214.       value to be sent in TCP header (this scaling is explained below).
  215.       The value shift.cnt may be zero (offering to scale, while applying
  216.       a scale factor of 1 to the receive window).
  217.  
  218.  
  219.  
  220. Jacobson & Braden                                               [Page 4]
  221.  
  222. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  223.  
  224.  
  225.       This option is an offer, not a promise; both sides must send
  226.       Window Scale options in their SYN segments to enable window
  227.       scaling in either direction.
  228.  
  229. 2.2  Using the Window Scale Option
  230.  
  231.       A model implementation of window scaling is as follows, using the
  232.       notation of RFC-793 [Postel81]:
  233.  
  234.       *    The send-window (SND.WND) and receive-window (RCV.WND) sizes
  235.            in the connection state block and in all sequence space
  236.            calculations are expanded from 16 to 32 bits.
  237.  
  238.       *    Two window shift counts are added to the connection state:
  239.            snd.scale and rcv.scale.  These are shift counts to be
  240.            applied to the incoming and outgoing windows, respectively.
  241.            The precise algorithm is shown below.
  242.  
  243.       *    All outgoing SYN segments are sent with the Window Scale
  244.            option, containing a value shift.cnt = R that the TCP would
  245.            like to use for its receive window.
  246.  
  247.       *    Snd.scale and rcv.scale are initialized to zero, and are
  248.            changed only during processing of a received SYN segment.  If
  249.            the SYN segment contains a Window Scale option with shift.cnt
  250.            = S, set snd.scale to S and set rcv.scale to R; otherwise,
  251.            both snd.scale and rcv.scale are left at zero.
  252.  
  253.       *    The window field (SEG.WND) in the header of every incoming
  254.            segment, with the exception of SYN segments, will be left-
  255.            shifted by snd.scale bits before updating SND.WND:
  256.  
  257.               SND.WND = SEG.WND << snd.scale
  258.  
  259.            (assuming the other conditions of RFC793 are met, and using
  260.            the "C" notation "<<" for left-shift).
  261.  
  262.       *    The window field (SEG.WND) of every outgoing segment, with
  263.            the exception of SYN segments, will have been right-shifted
  264.            by rcv.scale bits:
  265.  
  266.               SEG.WND = RCV.WND >> rcv.scale.
  267.  
  268.  
  269.       TCP determines if a data segment is "old" or "new" by testing if
  270.       its sequence number is within 2**31 bytes of the left edge of the
  271.       window.  If not, the data is "old" and discarded.  To insure that
  272.       new data is never mistakenly considered old and vice-versa, the
  273.  
  274.  
  275.  
  276. Jacobson & Braden                                               [Page 5]
  277.  
  278. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  279.  
  280.  
  281.       left edge of the sender's window has to be at least 2**31 away
  282.       from the right edge of the receiver's window.  Similarly with the
  283.       sender's right edge and receiver's left edge.  Since the right and
  284.       left edges of either the sender's or receiver's window differ by
  285.       the window size, and since the sender and receiver windows can be
  286.       out of phase by at most the window size, the above constraints
  287.       imply that 2 * the max window size must be less than 2**31, or
  288.  
  289.            max window < 2**30
  290.  
  291.       Since the max window is 2**S (where S is the scaling shift count)
  292.       times at most 2**16 - 1 (the maximum unscaled window), the maximum
  293.       window is guaranteed to be < 2*30 if S <= 14.  Thus, the shift
  294.       count must be limited to 14.  (This allows windows of 2**30 = 1
  295.       Gbyte.)  If a Window Scale option is received with a shift.cnt
  296.       value exceeding 14, the TCP should log the error but use 14
  297.       instead of the specified value.
  298.  
  299.  
  300. 3. TCP SELECTIVE ACKNOWLEDGMENT OPTIONS
  301.  
  302.    To minimize the impact on the TCP protocol, the selective
  303.    acknowledgment extension uses the form of two new TCP options. The
  304.    first is an enabling option, "SACK-permitted", that may be sent in a
  305.    SYN segment to indicate that the the SACK option may be used once the
  306.    connection is established.  The other is the SACK option itself,
  307.    which may be sent over an established connection once permission has
  308.    been given by SACK-permitted.
  309.  
  310.    The SACK option is to be included in a segment sent from a TCP that
  311.    is receiving data to the TCP that is sending that data; we will refer
  312.    to these TCP's as the data receiver and the data sender,
  313.    respectively.  We will consider a particular simplex data flow; any
  314.    data flowing in the reverse direction over the same connection can be
  315.    treated independently.
  316.  
  317. 3.1  SACK-Permitted Option
  318.  
  319.       This two-byte option may be sent in a SYN by a TCP that has been
  320.       extended to receive (and presumably process) the SACK option once
  321.       the connection has opened.
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332. Jacobson & Braden                                               [Page 6]
  333.  
  334. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  335.  
  336.  
  337.       TCP Sack-Permitted Option:
  338.  
  339.       Kind: 4
  340.  
  341.              +---------+---------+
  342.              | Kind=4  | Length=2|
  343.              +---------+---------+
  344.  
  345. 3.2  SACK Option
  346.  
  347.       The SACK option is to be used to convey extended acknowledgment
  348.       information over an established connection.  Specifically, it is
  349.       to be sent by a data receiver to inform the data transmitter of
  350.       non-contiguous blocks of data that have been received and queued.
  351.       The data receiver is awaiting the receipt of data in later
  352.       retransmissions to fill the gaps in sequence space between these
  353.       blocks.  At that time, the data receiver will acknowledge the data
  354.       normally by advancing the left window edge in the Acknowledgment
  355.       Number field of the TCP header.
  356.  
  357.       It is important to understand that the SACK option will not change
  358.       the meaning of the Acknowledgment Number field, whose value will
  359.       still specify the left window edge, i.e., one byte beyond the last
  360.       sequence number of fully-received data.  The SACK option is
  361.       advisory; if it is ignored, TCP acknowledgments will continue to
  362.       function as specified in the protocol.
  363.  
  364.       However, SACK will provide additional information that the data
  365.       transmitter can use to optimize retransmissions.  The TCP data
  366.       receiver may include the SACK option in an acknowledgment segment
  367.       whenever it has data that is queued and unacknowledged.  Of
  368.       course, the SACK option may be sent only when the TCP has received
  369.       the SACK-permitted option in the SYN segment for that connection.
  370.  
  371.       TCP SACK Option:
  372.  
  373.       Kind: 5
  374.  
  375.       Length: Variable
  376.  
  377.  
  378.        +--------+--------+--------+--------+--------+--------+...---+
  379.        | Kind=5 | Length | Relative Origin |   Block Size    |      |
  380.        +--------+--------+--------+--------+--------+--------+...---+
  381.  
  382.  
  383.       This option contains a list of the blocks of contiguous sequence
  384.       space occupied by data that has been received and queued within
  385.  
  386.  
  387.  
  388. Jacobson & Braden                                               [Page 7]
  389.  
  390. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  391.  
  392.  
  393.       the window.  Each block is contiguous and isolated; that is, the
  394.       octets just below the block,
  395.  
  396.              Acknowledgment Number + Relative Origin -1,
  397.  
  398.       and just above the block,
  399.  
  400.              Acknowledgment Number + Relative Origin + Block Size,
  401.  
  402.       have not been received.
  403.  
  404.       Each contiguous block of data queued at the receiver is defined in
  405.       the SACK option by two 16-bit integers:
  406.  
  407.  
  408.       *    Relative Origin
  409.  
  410.            This is the first sequence number of this block, relative to
  411.            the Acknowledgment Number field in the TCP header (i.e.,
  412.            relative to the data receiver's left window edge).
  413.  
  414.  
  415.       *    Block Size
  416.  
  417.            This is the size in octets of this block of contiguous data.
  418.  
  419.  
  420.       A SACK option that specifies n blocks will have a length of 4*n+2
  421.       octets, so the 44 bytes available for TCP options can specify a
  422.       maximum of 10 blocks.  Of course, if other TCP options are
  423.       introduced, they will compete for the 44 bytes, and the limit of
  424.       10 may be reduced in particular segments.
  425.  
  426.       There is no requirement on the order in which blocks can appear in
  427.       a single SACK option.
  428.  
  429.          Note: requiring that the blocks be ordered would allow a
  430.          slightly more efficient algorithm in the transmitter; however,
  431.          this does not seem to be an important optimization.
  432.  
  433. 3.3  SACK with Window Scaling
  434.  
  435.       If window scaling is in effect, then 16 bits may not be sufficient
  436.       for the SACK option fields that define the origin and length of a
  437.       block.  There are two possible ways to handle this:
  438.  
  439.       (1)  Expand the SACK origin and length fields to 24 or 32 bits.
  440.  
  441.  
  442.  
  443.  
  444. Jacobson & Braden                                               [Page 8]
  445.  
  446. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  447.  
  448.  
  449.       (2)  Scale the SACK fields by the same factor as the window.
  450.  
  451.  
  452.       The first alternative would significantly reduce the number of
  453.       blocks possible in a SACK option; therefore, we have chosen the
  454.       second alternative, scaling the SACK information as well as the
  455.       window.
  456.  
  457.       Scaling the SACK information introduces some loss of precision,
  458.       since a SACK option must report queued data blocks whose origins
  459.       and lengths are multiples of the window scale factor rcv.scale.
  460.       These reported blocks must be equal to or smaller than the actual
  461.       blocks of queued data.
  462.  
  463.       Specifically, suppose that the receiver has a contiguous block of
  464.       queued data that occupies sequence numbers L, L+1, ... L+N-1, and
  465.       that the window scale factor is S = rcv.scale.  Then the
  466.       corresponding block that will be reported in a SACK option will
  467.       be:
  468.  
  469.          Relative Origin = int((L+S-1)/S)
  470.  
  471.          Block Size = int((L+N)/S) - (Relative Origin)
  472.  
  473.       where the function int(x) returns the greatest integer contained
  474.       in x.
  475.  
  476.       The resulting loss of precision is not a serious problem for the
  477.       sender.  If the data-sending TCP keeps track of the boundaries of
  478.       all segments in its retransmission queue, it will generally be
  479.       able to infer from the imprecise SACK data which full segments
  480.       don't need to be retransmitted.  This will fail only if S is
  481.       larger than the maximum segment size, in which case some segments
  482.       may be retransmitted unnecessarily.  If the sending TCP does not
  483.       keep track of transmitted segment boundaries, the imprecision of
  484.       the scaled SACK quantities will only result in retransmitting a
  485.       small amount of unneeded sequence space.  On the average, the data
  486.       sender will unnecessarily retransmit J*S bytes of the sequence
  487.       space for each SACK received; here J is the number of blocks
  488.       reported in the SACK, and S = snd.scale.
  489.  
  490. 3.4  SACK Option Examples
  491.  
  492.       Assume the left window edge is 5000 and that the data transmitter
  493.       sends a burst of 8 segments, each containing 500 data bytes.
  494.       Unless specified otherwise, we assume that the scale factor S = 1.
  495.  
  496.  
  497.  
  498.  
  499.  
  500. Jacobson & Braden                                               [Page 9]
  501.  
  502. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  503.  
  504.  
  505.            Case 1: The first 4 segments are received but the last 4 are
  506.            dropped.
  507.  
  508.            The data receiver will return a normal TCP ACK segment
  509.            acknowledging sequence number 7000, with no SACK option.
  510.  
  511.  
  512.            Case 2:  The first segment is dropped but the remaining 7 are
  513.            received.
  514.  
  515.            The data receiver will return a TCP ACK segment that
  516.            acknowledges sequence number 5000 and contains a SACK option
  517.            specifying one block of queued data:
  518.  
  519.                    Relative Origin = 500;  Block Size = 3500
  520.  
  521.  
  522.            Case 3:  The 2nd, 4th, 6th, and 8th (last) segments are
  523.            dropped.
  524.  
  525.            The data receiver will return a TCP ACK segment that
  526.            acknowledges sequence number 5500 and contains a SACK option
  527.            specifying the 3 blocks:
  528.  
  529.                    Relative Origin =  500;  Block Size = 500
  530.                    Relative Origin = 1500;  Block Size = 500
  531.                    Relative Origin = 2500;  Block Size = 500
  532.  
  533.  
  534.            Case 4: Same as Case 3, except Scale Factor S = 16.
  535.  
  536.            The SACK option would specify the 3 scaled blocks:
  537.  
  538.                    Relative Origin =   32;  Block Size = 30
  539.                    Relative Origin =   94;  Block Size = 31
  540.                    Relative Origin =  157;  Block Size = 30
  541.  
  542.            These three reported blocks have sequence numbers 512 through
  543.            991, 1504 through 1999, and 2512 through 2992, respectively.
  544.  
  545.  
  546. 3.5  Generating the SACK Option
  547.  
  548.       Let us assume that the data receiver maintains a queue of valid
  549.       segments that it has neither passed to the user nor acknowledged
  550.       because of earlier missing data, and that this queue is ordered by
  551.       starting sequence number.  Computation of the SACK option can be
  552.       done with one pass down this queue.  Segments that occupy
  553.  
  554.  
  555.  
  556. Jacobson & Braden                                              [Page 10]
  557.  
  558. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  559.  
  560.  
  561.       contiguous sequence space are aggregated into a single SACK block,
  562.       and each gap in the sequence space (except a gap that is
  563.       terminated by the right window edge) triggers the start of a new
  564.       SACK block.  If this algorithm defines more than 10 blocks, only
  565.       the first 10 can be included in the option.
  566.  
  567. 3.6  Interpreting the SACK Option
  568.  
  569.       The data transmitter is assumed to have a retransmission queue
  570.       that contains the segments that have been transmitted but not yet
  571.       acknowledged, in sequence-number order.  If the data transmitter
  572.       performs re-packetization before retransmission, the block
  573.       boundaries in a SACK option that it receives may not fall on
  574.       boundaries of segments in the retransmission queue; however, this
  575.       does not pose a serious difficulty for the transmitter.
  576.  
  577.       Let us suppose that for each segment in the retransmission queue
  578.       there is a (new) flag bit "ACK'd", to be used to indicate that
  579.       this particular segment has been entirely acknowledged.  When a
  580.       segment is first transmitted, it will be entered into the
  581.       retransmission queue with its ACK'd bit off.  If the ACK'd bit is
  582.       subsequently turned on (as the result of processing a received
  583.       SACK option), the data transmitter will skip this segment during
  584.       any later retransmission.  However, the segment will not be
  585.       dequeued and its buffer freed until the left window edge is
  586.       advanced over it.
  587.  
  588.       When an acknowledgment segment arrives containing a SACK option,
  589.       the data transmitter will turn on the ACK'd bits for segments that
  590.       have been selectively acknowleged.  More specifically, for each
  591.       block in the SACK option, the data transmitter will turn on the
  592.       ACK'd flags for all segments in the retransmission queue that are
  593.       wholly contained within that block.  This requires straightforward
  594.       sequence number comparisons.
  595.  
  596.  
  597. 4.  TCP ECHO OPTIONS
  598.  
  599.    A simple method for measuring the RTT of a segment would be: the
  600.    sender places a timestamp in the segment and the receiver returns
  601.    that timestamp in the corresponding ACK segment. When the ACK segment
  602.    arrives at the sender, the difference between the current time and
  603.    the timestamp is the RTT.  To implement this timing method, the
  604.    receiver must simply reflect or echo selected data (the timestamp)
  605.    from the sender's segments.  This idea is the basis of the "TCP Echo"
  606.    and "TCP Echo Reply" options.
  607.  
  608.  
  609.  
  610.  
  611.  
  612. Jacobson & Braden                                              [Page 11]
  613.  
  614. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  615.  
  616.  
  617. 4.1  TCP Echo and TCP Echo Reply Options
  618.  
  619.       TCP Echo Option:
  620.  
  621.       Kind: 6
  622.  
  623.       Length: 6
  624.  
  625.           +--------+--------+--------+--------+--------+--------+
  626.           | Kind=6 | Length |   4 bytes of info to be echoed    |
  627.           +--------+--------+--------+--------+--------+--------+
  628.  
  629.    This option carries four bytes of information that the receiving TCP
  630.    may send back in a subsequent TCP Echo Reply option (see below).  A
  631.    TCP may send the TCP Echo option in any segment, but only if a TCP
  632.    Echo option was received in a SYN segment for the connection.
  633.  
  634.    When the TCP echo option is used for RTT measurement, it will be
  635.    included in data segments, and the four information bytes will define
  636.    the time at which the data segment was transmitted in any format
  637.    convenient to the sender.
  638.  
  639.    TCP Echo Reply Option:
  640.  
  641.    Kind: 7
  642.  
  643.    Length: 6
  644.  
  645.        +--------+--------+--------+--------+--------+--------+
  646.        | Kind=7 | Length |    4 bytes of echoed info         |
  647.        +--------+--------+--------+--------+--------+--------+
  648.  
  649.  
  650.    A TCP that receives a TCP Echo option containing four information
  651.    bytes will return these same bytes in a TCP Echo Reply option.
  652.  
  653.    This TCP Echo Reply option must be returned in the next segment
  654.    (e.g., an ACK segment) that is sent. If more than one Echo option is
  655.    received before a reply segment is sent, the TCP must choose only one
  656.    of the options to echo, ignoring the others; specifically, it must
  657.    choose the newest segment with the oldest sequence number (see next
  658.    section.)
  659.  
  660.    To use the TCP Echo and Echo Reply options, a TCP must send a TCP
  661.    Echo option in its own SYN segment and receive a TCP Echo option in a
  662.    SYN segment from the other TCP.  A TCP that does not implement the
  663.    TCP Echo or Echo Reply options must simply ignore any TCP Echo
  664.    options it receives.  However, a TCP should not receive one of these
  665.  
  666.  
  667.  
  668. Jacobson & Braden                                              [Page 12]
  669.  
  670. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  671.  
  672.  
  673.    options in a non-SYN segment unless it included a TCP Echo option in
  674.    its own SYN segment.
  675.  
  676. 4.2  Using the Echo Options
  677.  
  678.    If we wish to use the Echo/Echo Reply options for RTT measurement, we
  679.    have to define what the receiver does when there is not a one-to-one
  680.    correspondence between data and ACK segments.  Assuming that we want
  681.    to minimize the state kept in the receiver (i.e., the number of
  682.    unprocessed Echo options), we can plan on a receiver remembering the
  683.    information value from at most one Echo between ACKs.  There are
  684.    three situations to consider:
  685.  
  686.    (A)  Delayed ACKs.
  687.  
  688.         Many TCP's acknowledge only every Kth segment out of a group of
  689.         segments arriving within a short time interval; this policy is
  690.         known generally as "delayed ACK's".  The data-sender TCP must
  691.         measure the effective RTT, including the additional time due to
  692.         delayed ACK's, or else it will retransmit unnecessarily.  Thus,
  693.         when delayed ACK's are in use, the receiver should reply with
  694.         the Echo option information from the earliest unacknowledged
  695.         segment.
  696.  
  697.    (B)  A hole in the sequence space (segment(s) have been lost).
  698.  
  699.         The sender will continue sending until the window is filled, and
  700.         we may be generating ACKs as these out-of-order segments arrive
  701.         (e.g., for the SACK information or to aid "fast retransmit").
  702.         An Echo Reply option will tell the sender the RTT of some
  703.         recently sent segment (since the ACK can only contain the
  704.         sequence number of the hole, the sender may not be able to
  705.         determine which segment, but that doesn't matter).  If the loss
  706.         was due to congestion, these RTTs may be particularly valuable
  707.         to the sender since they reflect the network characteristics
  708.         immediately after the congestion.
  709.  
  710.    (C)  A filled hole in the sequence space.
  711.  
  712.         The segment that fills the hole represents the most recent
  713.         measurement of the network characteristics.  On the other hand,
  714.         an RTT computed from an earlier segment would probably include
  715.         the sender's retransmit time-out, badly biasing the sender's
  716.         average RTT estimate.
  717.  
  718.  
  719.    Case (A) suggests the receiver should remember and return the Echo
  720.    option information from the oldest unacknowledged segment.  Cases (B)
  721.  
  722.  
  723.  
  724. Jacobson & Braden                                              [Page 13]
  725.  
  726. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  727.  
  728.  
  729.    and (C) suggest that the option should come from the most recent
  730.    unacknowledged segment.  An algorithm that covers all three cases is
  731.    for the receiver to return the Echo option information from the
  732.    newest segment with the oldest sequence number, as specified earlier.
  733.  
  734.    A model implementation of these options is as follows.
  735.  
  736.  
  737.    (1)  Receiver Implementation
  738.  
  739.         A 32-bit slot for Echo option data, rcv.echodata, is added to
  740.         the receiver connection state, together with a flag,
  741.         rcv.echopresent, that indicates whether there is anything in the
  742.         slot.  When the receiver generates a segment, it checks
  743.         rcv.echopresent and, if it is set, adds an echo-reply option
  744.         containing rcv.echodata to the outgoing segment then clears
  745.         rcv.echopresent.
  746.  
  747.         If an incoming segment is in the window and contains an echo
  748.         option, the receiver checks rcv.echopresent.  If it isn't set,
  749.         the value of the echo option is copied to rcv.echodata and
  750.         rcv.echopresent is set.  If rcv.echopresent is already set, the
  751.         receiver checks whether the segment is at the left edge of the
  752.         window.  If so, the segment's echo option value is copied to
  753.         rcv.echodata (this is situation (C) above).  Otherwise, the
  754.         segment's echo option is ignored.
  755.  
  756.  
  757.    (2)  Sender Implementation
  758.  
  759.         The sender's connection state has a single flag bit,
  760.         snd.echoallowed, added.  If snd.echoallowed is set or if the
  761.         segment contains a SYN, the sender is free to add a TCP Echo
  762.         option (presumably containing the current time in some units
  763.         convenient to the sender) to every outgoing segment.
  764.  
  765.         Snd.echoallowed should be set if a SYN is received with a TCP
  766.         Echo option (presumably, a host that implements the option will
  767.         attempt to use it to time the SYN segment).
  768.  
  769.  
  770. 5.  CONCLUSIONS AND ACKNOWLEDGMENTS
  771.  
  772. We have proposed five new TCP options for scaled windows, selective
  773. acknowledgments, and round-trip timing, in order to provide efficient
  774. operation over large-bandwidth*delay-product paths.  These extensions
  775. are designed to provide compatible interworking with TCP's that do not
  776. implement the extensions.
  777.  
  778.  
  779.  
  780. Jacobson & Braden                                              [Page 14]
  781.  
  782. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  783.  
  784.  
  785. The Window Scale option was originally suggested by Mike St. Johns of
  786. USAF/DCA.  The present form of the option was suggested by Mike Karels
  787. of UC Berkeley in response to a more cumbersome scheme proposed by Van
  788. Jacobson.  Gerd Beling of FGAN (West Germany) contributed the initial
  789. definition of the SACK option.
  790.  
  791. All three options have evolved through discussion with the End-to-End
  792. Task Force, and the authors are grateful to the other members of the
  793. Task Force for their advice and encouragement.
  794.  
  795. 6.  REFERENCES
  796.  
  797.       [Cheriton88]  Cheriton, D., "VMTP: Versatile Message Transaction
  798.       Protocol", RFC 1045, Stanford University, February 1988.
  799.  
  800.       [Jain86]  Jain, R., "Divergence of Timeout Algorithms for Packet
  801.       Retransmissions", Proc. Fifth Phoenix Conf. on Comp. and Comm.,
  802.       Scottsdale, Arizona, March 1986.
  803.  
  804.       [Karn87]  Karn, P. and C. Partridge, "Estimating Round-Trip Times
  805.       in Reliable Transport Protocols", Proc. SIGCOMM '87, Stowe, VT,
  806.       August 1987.
  807.  
  808.       [Clark87] Clark, D., Lambert, M., and L. Zhang, "NETBLT: A Bulk
  809.       Data Transfer Protocol", RFC 998, MIT, March 1987.
  810.  
  811.       [Nagle84]  Nagle, J., "Congestion Control in IP/TCP
  812.       Internetworks", RFC 896, FACC, January 1984.
  813.  
  814.       [NBS85]  Colella, R., Aronoff, R., and K. Mills, "Performance
  815.       Improvements for ISO Transport", Ninth Data Comm Symposium,
  816.       published in ACM SIGCOMM Comp Comm Review, vol. 15, no. 5,
  817.       September 1985.
  818.  
  819.       [Partridge87]  Partridge, C., "Private Communication", February
  820.       1987.
  821.  
  822.       [Postel81]  Postel, J., "Transmission Control Protocol - DARPA
  823.       Internet Program Protocol Specification", RFC 793, DARPA,
  824.       September 1981.
  825.  
  826.       [Velten84] Velten, D., Hinden, R., and J. Sax, "Reliable Data
  827.       Protocol", RFC 908, BBN, July 1984.
  828.  
  829.       [Jacobson88] Jacobson, V., "Congestion Avoidance and Control", to
  830.       be presented at SIGCOMM '88, Stanford, CA., August 1988.
  831.  
  832.       [Zhang86]  Zhang, L., "Why TCP Timers Don't Work Well", Proc.
  833.  
  834.  
  835.  
  836. Jacobson & Braden                                              [Page 15]
  837.  
  838. RFC 1072          TCP Extensions for Long-Delay Paths       October 1988
  839.  
  840.  
  841.       SIGCOMM '86, Stowe, Vt., August 1986.
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892. Jacobson & Braden                                              [Page 16]
  893.  
  894.